home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / programming / libraries / supralib.lha / SupraLib / source / RecDirFree.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-03-08  |  1.4 KB  |  55 lines

  1. /****** RecDirFree *************************************************
  2. *
  3. *   NAME
  4. *       RecDirFree -- Unlocks all locked paths (V10)
  5. *       (dos V36)
  6. *
  7. *   SYNOPSIS
  8. *       void RecDirFree(RecDirInfo)
  9. *
  10. *       void RecDirFree(struct RecDirInfo *);
  11. *
  12. *   FUNCTION
  13. *       This function is called internally when error occurs in
  14. *       RecDirNext(), so you don't have to call it then!
  15. *       You can only call it when you no longer want to use RecDirNext(),
  16. *       before it finishes the scanning process.
  17. *       You DO NOT have to call RecDirFree() when you get any error,
  18. *       even DN_ERR_END (scanning process complete)!
  19. *
  20. *   INPUTS
  21. *       RecDirInfo - pointer to struct RecDirInfo which has been
  22. *                    called with RecDirInit()
  23. *
  24. *   RESULT
  25. *       none
  26. *
  27. *   SEE ALSO
  28. *       RecDirInit(), RecDirNext(), RecDirNextTagList()
  29. *
  30. *******************************************************************/
  31.  
  32. #include <clib/exec_protos.h>
  33. #include <exec/memory.h>
  34. #include <dos/dos.h>
  35. #include <stdlib.h>
  36. #include <libraries/supra.h>
  37.  
  38. extern struct Library *DOSBase;
  39.  
  40.  
  41. void RecDirFree(struct RecDirInfo *rdi)
  42. {
  43.     struct LockNode *ln;
  44.  
  45.     while (rdi->rdi_Deep > 0) {
  46.         ln = rdi->rdi_Node;
  47.         FreeMem(ln->ln_Path, ln->ln_Len);
  48.         FreeMem(ln->ln_FIB, sizeof(struct FileInfoBlock));
  49.         UnLock(ln->ln_Lock);
  50.         rdi->rdi_Node = ln->ln_Pred;
  51.         FreeMem(ln,sizeof(struct LockNode));
  52.         rdi->rdi_Deep--;
  53.     }
  54. }
  55.